#ifndef CAFFEINE_UTILITY_INTERFACECONVERSION_HPP
#define CAFFEINE_UTILITY_INTERFACECONVERSION_HPP

#include "Graphics/Colour.hpp"
#include "Math/Vector.hpp"

#include "Box2D/Common/b2Math.h"

#include "SFML/Graphics/Color.hpp"
#include "SFML/System/Vector2.hpp"

namespace Utility
{
	float SFMLScale( void );

	b2Vec2 Box2DVector( const Math::Vectorf &vec );

	Math::Vectorf CaffVector( const b2Vec2 &vec );

	template< typename Type >
	Math::Vector< Type > CaffVector( const sf::Vector2< Type > &vec, bool positionVec = true )
	{
		Type y = vec.y;

		if ( positionVec )
		{
			y *= -1;
		}

		return Math::Vector< Type >( vec.x, y ) / SFMLScale();
	}

	template< typename Type >
	sf::Vector2< Type > SFMLVector( const Math::Vector< Type >& vec, bool positionVec = true )
	{
		Type y = vec.y;

		if ( positionVec )
		{
			y *= -1;
		}

		return sf::Vector2f( vec.x, y ) * SFMLScale();
	}

	Graphics::Colour CaffColour( const sf::Color &col );
	sf::Color SFMLColour( const Graphics::Colour &col );
}

#endif //CAFFEINE_UTILITY_INTERFACECONVERSION_HPP